package com.tongcao.cn.oauth.handler;

import com.google.common.collect.Maps;
import com.tongcao.cn.oauth.props.JumpProperties;

import java.util.Map;

/**
 * @author:tongcao
 * @since:2019/11/22 11:05
 * Description:
 */
public abstract class BaseJumpHandler<T extends JumpProperties> implements ThirdPartyHandler<T>{

    private    Map<String, String> searchEngineUriMap = Maps.newConcurrentMap();

    protected T jumpProperties;




    /**
     * 第三方配置文件
     *
     * @return
     */
    @Override
    public T getThirdPartyProperties() {
        return jumpProperties;
    }

    /**
     * 跳转错误页
     *
     * @param code
     * @return
     */
    @Override
    public String jumpErrorUri(String code) {
        return searchEngineUriMap.get("searchEngineUri" + code);
    }

    /**
     * H5原始页
     *
     * @return
     */
    @Override
    public String getJumpUri() {
        return jumpProperties.getBaseInfoUrl();
    }


    /**
     * 黑名单跳转页
     *
     * @return
     */
    @Override
    public String getBlackListUrl() {
        return null;
    }

    public Map<String, String> getSearchEngineUriMap() {
        return searchEngineUriMap;
    }

    public void setSearchEngineUriMap(Map<String, String> searchEngineUriMap) {
        this.searchEngineUriMap = searchEngineUriMap;
    }


    public T getJumpProperties() {
        return jumpProperties;
    }

    public void setJumpProperties(T jumpProperties) {
        this.jumpProperties = jumpProperties;
    }
}